package com.mairuide.one_click_search.service;

import com.mairuide._frame.utils.sheethandler.oneKey.OneKeyPOIFactory;
import org.springframework.web.multipart.MultipartFile;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.util.Map;
import java.util.concurrent.Callable;

/**
 * @Description
 * @auther 刘中华
 * @create 2019-04-24 16:22
 */
public class OneKeyWorkTask implements Callable<Map<String,Object>> {
    private MultipartFile file;
    Map<String , Object> paramMap;
    public OneKeyWorkTask(MultipartFile file,Map<String , Object> paramMap) {
        this.file = file;
        this.paramMap = paramMap;
    }
    @Override
    public Map<String,Object> call() {
        Map<String, Object> map = null;
        try {
            InputStream inputStream = new BufferedInputStream(file.getInputStream());
            map = OneKeyPOIFactory.deal(inputStream, paramMap);
            map.put("fileName",file.getOriginalFilename());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return map;
    }
}
